﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OracleClient;
using System.Text;
using ReflectionStudio.Core.Events;
using INTEX.DataBase;
using INTEX.DataBase.Tools;
using System.Linq;
namespace WPFExcelReport
{
    //
    public class YCAFB02Data : BaseFunction
    {

        ApplicationBase app
        {
            get
            {
                return ApplicationBase.Instance;
            }
        }
        public INTEXDBC INTEXDBC
        {
            get
            {
                return app.INTEXDBC;
            }
        }
      public  SETINTEXDB INTEXDB = new SETINTEXDB();
        public YCAFB02Data()
            : base()
        {
            Helpers.Helper.GetDate(ref date, ref year, ref month, ref day);
        }
        public YCAFB02Data(OracleConnection _OracleDB, IntexReptServBLClient _proxy, string userID = "        ")
            : base(_OracleDB, _proxy, userID)
        {
            Helpers.Helper.GetDate(ref date, ref year, ref month, ref day);
            
        }
        public YCAFB02Data(Dictionary<string, object> DicGlobalPara)
            : base(DicGlobalPara)
        {
            Helpers.Helper.GetDate(ref date, ref year, ref month, ref day);
        }
        public DataSet LoadEvn()
        {
            DataSet SReturn = new DataSet();
            DataSet SResult = new DataSet();
            /*DataRow dwData = INTEXDB.LIEFDAT.NewLIEFDATRow();
            dwData["LSMANDANT"] = "00";
            SResult = INTEXDBC.QueryLIEFDAT(dwData, 6);
            SReturn.Merge(SResult);
            dwData = INTEXDB.ICC_SECTION.NewRow();
            dwData["SDSA"] = "0247";
            SResult = INTEXDBC.QuerySDDAT(dwData, 3);
            SResult.Tables[0].TableName = "ICC_SECTION";
            foreach (DataRow row in SResult.Tables[0].Rows)
            {
                row["SDDATEN"] = Helpers.Helper.GetGB2312Value(row["SDDATEN"].ToString());
            }*/
            SReturn.Merge(SResult);
            return SReturn;
        } 
        public DataSet BuildData(DataRow dwInput)
        {
            DataSet Result = new DataSet();
            DataSet Return = new DataSet();
            try
            {
                INTEXDBC.DeleteICC_FB02(dwInput, 1);
                INTEXDBC.InsertICC_FB02(dwInput, 1);
                INTEXDBC.InsertICC_FB02(dwInput, 2);
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            return Return;
        }
        public DataSet GetData(DataRow dwInput,int options)
        {
            DataSet Result = new DataSet();
            DataSet Return = new DataSet();
            try
            {
                Result = INTEXDBC.QueryICC_FB02(dwInput, 1);
                Return.Merge(Result);
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            return Return;
        }
    }
}